package com.lzy.cloud.payment.constants;

/**
 * Description: 支付模块常量
 *
 * @author lc Create Date Time:Mar 21, 20173:10:57 PM
 */
public class CommonConstants {

    public static enum PayWay {
        alipay("支付宝", 0), weixin("微信", 1), ICBC("银行卡", 2);

        private String name;
        private int index;

        private PayWay(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (PayWay c : PayWay.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }

    //订单中券流向记录类型状态
    public static enum OrderCouponLogType {
        LOCK(0,"锁定"),
        CONSUME(1,"用户消费"),
        RETURN(2,"系统退回"),
        BUY(3,"购买");

        private Integer code;
        private String name;

        private OrderCouponLogType(Integer code,String name) {
            this.name = name;
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public Integer getCode() {
            return code;
        }

        public static String getName(Integer code) {
            for (OrderCouponLogType c : OrderCouponLogType.values()) {
                if (c.getCode() == code) {
                    return c.name;
                }
            }
            return null;
        }
    }

    //支付业务类型
    public static enum PayBusType {
        pay("支付", 0), recharge("充值", 1), withdraw("提现", 2), refund("退款", 3);

        private String name;
        private int index;

        private PayBusType(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }
    }

    //冲正标识
    public static enum CorrectFlag {
        CORRECT_FLAG("正常", 0), CORRECT_FLAGS("已冲正", 1);

        private String name;
        private int index;

        private CorrectFlag(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }
    }

    //订单支付状态
    public static enum OrderPayStatus {
        NOPAY("未付款", 0), YESPAY("已付款", 1), FAIL("失败", 2);

        private String name;
        private int index;

        private OrderPayStatus(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (OrderPayStatus c : OrderPayStatus.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }

    //支付网管是否可用
    public static enum PayWayEnabledStatus {
        USE("可用", 0), NOUSE("不可用", 1);

        private String name;
        private int index;

        private PayWayEnabledStatus(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (PayWayEnabledStatus c : PayWayEnabledStatus.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }


    //支付退款状态
    public static enum PayRefundStatus {
        WAIT("等待退款", 0), SUCCESS("退款成功", 1), DISPOSE("退款处理中", 2), UNUSUAL("退款异常", 3), INDETERM("未确定", 4), CLOSE("退款关闭", 5);

        private String name;
        private int index;

        private PayRefundStatus(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (PayRefundStatus c : PayRefundStatus.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }

    //交易类型
    public static enum TradeType {
        pay("支付", 0);
        private String name;
        private int index;

        private TradeType(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (TradeType c : TradeType.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }

    //账单类型
    public static enum BillType {
        pay("在线支付", 0),refund("在线退款",1);

        private String name;
        private int index;

        private BillType(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (BillType c : BillType.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }
    //支付来源类型
    public static enum PayTargetType {
        APP("APP", 0), WEB("WEB", 1);

        private String name;
        private int index;

        private PayTargetType(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public String getName() {
            return name;
        }

        public int getIndex() {
            return index;
        }

        public static String getName(int index) {
            for (PayTargetType c : PayTargetType.values()) {
                if (c.getIndex() == index) {
                    return c.name;
                }
            }
            return null;
        }
    }

    //支付宝成功返回
    public static final String SUCCESS = "SUCCESS";
    //支付宝失败返回
    public static final String FAIL = "fail";
    //微信
    public static final String OK = "ok";
    //微信返回状态码
    public static final String RETURN_CODE = "return_code";
    //微信返回信息
    public static final String RETURN_MSG = "return_msg";
    public static final String RESULT_CODE = "result_code";
    public static final String APP = "APP";    //APP支付
    public static final String WEB = "JSAPI";  //微信公众账号支付
    public static final String SCAN_CODE = "NATIVE"; //扫码支付
    public static final String METHOD = "alipay.trade.refund";
    public static final String METHOD_QUERY = "alipay.trade.fastpay.refund.query";
    //微信退款状态
    public static final String REFUND_STATUS = "refund_status_0";
    public static final String SKU_NAME = "浙江龙之游旅游开发有限公司";
    public static final String PRODUCT_CODE = "QUICK_MSECURITY_PAY";

    //时间
    public static final String DAY_TIME = "yyyy-MM-dd";

    //龙珠系统账户
    public static final Long LZ_SYSTEM_USER_ID = 0L;
}
